package com.hnevc.chenqi;

import java.io.*;

/**
 * 使用包装流进行文件拷贝
 * BuffereReader
 * BufferedWriter
 *
 */
public class Example03 {
    public static void main(String[] args) throws Exception{
        try {
            FileReader reader =new FileReader("text.txt");
            BufferedReader bf = new BufferedReader(reader);
            FileWriter writer = new FileWriter("src\\text2.txt");
            BufferedWriter wr =new BufferedWriter(writer);
            String str ;//每行读取的内容存放在str
            while ((str =bf.readLine()) != null){
                wr.write(str);
                wr.newLine();
            }
            bf.close();
            wr.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }

    }
}
